package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class PageController {

    @Autowired
    private DataService service;


    @PostMapping("/visit")
    public List<RegionStats> index() {
        return service.getList();
    }

    @PostMapping("/search")
    public RegionStats search(@RequestParam String country) {

        return service.searchItem(country);
    }

}
